package com.oneday.nuo.base.security.login;

import com.oneday.nuo.base.security.user.NuoUserDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.stereotype.Component;

/**登录认证流程
 * 1、用户密码登录
 * 2、邮箱登录
 * 3、手机登录
 * @author liushuai
 * @date 2020/8/21 22:13
 */
@Component("nuoAuthenticationManager")
public class NuoAuthenticationManager implements AuthenticationManager {
    @Autowired
    private NuoUserDetailsService nuoUserDetailsService;

    @Autowired
    private NuoAuthenticationProvider nuoAuthenticationProvider;


    @Override
    public Authentication authenticate(Authentication authentication) throws AuthenticationException {
        //账户密码登录
        authentication =    nuoAuthenticationProvider.authenticate(authentication);
        return authentication;
    }
}
